package com.CmJava.model;

import com.CmJava.FrameData;

import javax.swing.*;
import java.awt.*;
/**
 * 类名：MyJPanel
 * 作用：游戏页面的主面板，用来显示下落方块和地图
 * 作者：陈铭
 * 日期：2021.02.23
 */
public class MyJPanel extends JPanel {
    private Map map=new Map();
    private Block block=new Block((FrameData.boxCol-3)/2,0);

    public MyJPanel() {
        this.setBackground(Color.LIGHT_GRAY);
        this.setLayout(null);
    }

    @Override
    protected void paintComponent(Graphics g) {
        block.drawMap(g);
        map.drawMap(g);
    }

    public Block getBlock() {
        return block;
    }

    public void setBlock(Block block) {
        this.block = block;
    }

    public Map getMap() {
        return map;
    }

    public void setMap(Map map) {
        this.map = map;
    }
}
